package usually;
//49. 字母异位词分组


import java.util.*;

public class Num49_groupAnagrams {
    public List<List<String>> groupAnagrams(String[] strs) {
        Map<String , List<String>> map = new HashMap<>();
        for (String str : strs){
            char[]arr = str.toCharArray();
            Arrays.sort(arr);
            String key = new String(arr);
            List<String> list = map.getOrDefault(key , new ArrayList<String>());
            list.add(str);
            map.put(key , list);//没有就创建
        }
        return new ArrayList<List<String>>(map.values());


    }
}
